package com.example.demo.config;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import com.example.demo.config.filter.BodyReaderFilter;
import com.example.demo.config.interceptor.RequestLogPrintInterceptor;

@Configuration
public class MyWebAppConfigurer extends WebMvcConfigurerAdapter
{
    
    @Bean
    public HandlerInterceptor myInterceptor()
    {
        return new RequestLogPrintInterceptor();
    }
    
    @Override
    public void addInterceptors(InterceptorRegistry registry)
    {
        registry.addInterceptor(myInterceptor()).addPathPatterns("/**");
        super.addInterceptors(registry);
    }
}
